<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <title>注册</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="css/style.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
    <link rel="stylesheet" href="css/element-icons.css" />
    <link rel="stylesheet" href="css/newiconfont.css" />
    <link rel="stylesheet" href="css/register.css" />
    <style>
        .tabrel05-hd .line {
            width: 50%;
        }
        .tabrel05-tit .tabrel05-item {
            width: 50%;
        }
    </style>
    <script src="js/jquery.min.js"></script>
    <script src="js/lib.js"></script>
    <script src="js/page.js"></script>
    <script src="js/register.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
    <link rel="stylesheet" href="css/all-ie-only.css" />
    <![endif]-->
</head>

<body>
    <div class="header4 fix">
        <div class="wp">
            <div class="header4-btn">
                <a href="login.html" class="a1 l">登 录</a>
                <a href="register.html" class="r">注 册</a>
            </div>
        </div>
    </div>
    <div class="main">
        <div class="box-login">
            <div class="wp">
                <div data-v-40afc40c="" class="login-page">
                    <div data-v-40afc40c="" class="home-content-top">实名认证</div>
                    <div data-v-40afc40c="" class="home-content-line"></div>
                    <div data-v-40afc40c="" class="home-content-box">
                        <div data-v-40afc40c="" class="tabs-content">
                            <!-- <div data-v-40afc40c="" class="tabs-bid-title">请保存你的BID Keystore文件</div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips">
                                <span data-v-40afc40c="" class="tips-radio"></span>请勿遗失Keystore文件，丢失后无法找回
                            </div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips">
                                <span data-v-40afc40c="" class="tips-radio"></span>请勿分享Keystore文件，否则你的数字资产可能面临被盗风险
                            </div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips tabs-second">
                                <span data-v-40afc40c="" class="tips-radio"></span>请及时备份你的Keystore文件
                            </div>
                            <button data-v-40afc40c="" type="button" class="el-button submit-btn el-button--primary">
                                <span>下载BID Keystore文件</span>
                            </button> -->
                            <!-- <div data-v-40afc40c="" class="separation-line"></div> -->
                            <div data-v-40afc40c="" class="tabs-bid-title">请保存你的私钥</div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips">
                                <span data-v-40afc40c="" class="tips-radio"></span>请勿遗失私钥，丢失后无法找回
                            </div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips">
                                <span data-v-40afc40c="" class="tips-radio"></span>请勿分享私钥，否则你的数字资产可能面临被盗风险
                            </div>
                            <div data-v-40afc40c="" class="tabs-bid-tips bind-long-tips tabs-second">
                                <span data-v-40afc40c="" class="tips-radio"></span>请及时备份私钥
                            </div>
                            <div data-v-40afc40c="" id="printTest">
                                <div data-v-40afc40c="" class="el-input el-input--suffix">
                                    <input type="text" readonly="readonly" autocomplete="off" class="el-input__inner" id="private">
                                    <span class="el-input__suffix">
                                        <span class="el-input__suffix-inner">
                                            <i data-v-40afc40c="" title="复制" class="el-input__icon e-copy el-icon-copy-document" style="color: rgb(64, 158, 255);"></i>
                                        </span>
                                    </span>
                                </div>
                            </div>
                            <div data-v-40afc40c="" class="certificate-title">
                                <span data-v-40afc40c="" class="dialog-content-border"></span>
                                <span data-v-40afc40c="" class="dialog-content-text">实名认证</span>
                            </div>
                            <div data-v-40afc40c="" class="certificate-item">
                                <span data-v-40afc40c="" class="item-title">用户类型</span>
                                <div data-v-40afc40c="" role="radiogroup" class="el-radio-group">
                                    <label id="typeLabel0" onclick="chooseType(0);" data-v-40afc40c="" role="radio" tabindex="0" class="el-radio is-bordered is-checked">
                                        <span id="typeSpan0" class="el-radio__input is-checked"><span class="el-radio__inner"></span>
                                            <input type="radio" aria-hidden="true" tabindex="-1" autocomplete="off" class="el-radio__original" value="1">
                                        </span>
                                        <span class="el-radio__label">个人用户</span>
                                    </label>
                                    <label id="typeLabel1" onclick="chooseType(1);" data-v-40afc40c="" role="radio" tabindex="-1" class="el-radio is-bordered">
                                        <span id="typeSpan1" class="el-radio__input"><span class="el-radio__inner"></span>
                                            <input type="radio" aria-hidden="true" tabindex="-1" autocomplete="off" class="el-radio__original" value="2">
                                        </span>
                                        <span class="el-radio__label">企业用户</span>
                                    </label>
                                </div>
                            </div>
                            <div id="personDiv">
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">身份证（正面）<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input">
                                        <input id="fileupload" type="file" name="file" class="el-input__inner" style="line-height: 41px;">
                                    </div>
                                    <div data-v-40afc40c="" class="item-file-upload" style="margin-left: 130px;margin-top: 10px;display: none;" id="personImage">
                                        <img src="" style="width: 100%;height: 100%" id="personImageSrc"/>
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title" style="width: 190px;">姓名<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" placeholder="上传身份证正面照片自动识别" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title" style="width: 190px;">身份证号码<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" placeholder="上传身份证反面照片自动识别" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title" style="width: 190px;">公钥<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" class="el-input__inner">
                                    </div>
                                </div>
                            </div>
                            <div id="businessDiv" style="display: none;">
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">企业名称<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" class="el-input__inner" placeholder="上传营业执照后自动识别">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">统一社会信用代码<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" placeholder="上传营业执照后自动识别" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">营业执照<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-file-upload"><span data-v-40afc40c="" class="el-icon-plus"></span></div>
                                    <input data-v-40afc40c="" type="file" class="person-yyzz-upload">
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">法定代表人身份证（反面）<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-file-upload"><span data-v-40afc40c="" class="el-icon-plus"></span></div>
                                    <input data-v-40afc40c="" type="file" class="person-sfzfm-upload">
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">公钥<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input is-disabled">
                                        <input type="text" disabled="disabled" autocomplete="off" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-title">
                                    <span data-v-40afc40c="" class="dialog-content-border"></span><span data-v-40afc40c="" class="dialog-content-text">联系人信息</span>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">姓名<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input">
                                        <input type="text" autocomplete="off" placeholder="请输入姓名" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">电话<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input">
                                        <input type="text" autocomplete="off" placeholder="请输入电话" class="el-input__inner">
                                    </div>
                                </div>
                                <div data-v-40afc40c="" class="certificate-item">
                                    <span data-v-40afc40c="" class="item-title">邮箱<span data-v-40afc40c="" style="color: red;">*</span></span>
                                    <div data-v-40afc40c="" class="item-iptval el-input">
                                        <input type="text" autocomplete="off" placeholder="请输入邮箱" class="el-input__inner">
                                    </div>
                                </div>
                            </div>
                            <div data-v-40afc40c="" class="confirm-wrap">
                                <button data-v-40afc40c="" type="button" class="el-button el-button--primary">
                                    <span>提交</span></button><button data-v-40afc40c="" type="button" class="el-button el-button--default">
                                <span>返回</span>
                            </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<!-- 显隐 end -->
<script src="js/module.js"></script>
<style type="text/css">
</style>
<script type="text/javascript">
    function chooseType(type){
        $("span[id^='typeSpan']").removeClass("is-checked");
        $("label[id^='typeLabel']").removeClass("is-checked");
        $("#typeSpan" + type + "").addClass("is-checked");
        $("#typeLabel" + type + "").addClass("is-checked");
        if(type == 0){
            $("#personDiv").show();
            $("#businessDiv").hide();
        }else if(type == 1){
            $("#personDiv").hide();
            $("#businessDiv").show();
        }
    }

    $("#fileupload").on("change", function(e){
        var fileobj = document.getElementById("fileupload");
        // fileobj.select();
        //需要失去焦点，不然下一步会报错：无法访问
        // fileobj.blur();
        /*var url = document.selection.createRange().text;
        console.log(url);
        console.log(document.selection.createRange());*/
        /*console.log($(this).get(0).files[0]);*/
        // console.log(document.selection.files[0]);
        // return;
       /* alert($(this).get(0).files[0]);
        var file = $(this).get(0).files[0];*/ 
        // var file = $(this).get(0).files[0];// 谷歌
        var imgpath = this.value;
        var img = new Image();
        img.src = imgpath;
        console.log('---', img)
        $("#personImage").show();

        var filePath = $(this).val();
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        var file = fso.getFile(filePath);
        console.log(file);
        var file = this.files[0];
        var data = new FormData();
        data.append("file", file);
        console.log(data);
        console.log(file);
        $.ajax({
            url: "/user-center-oauth/blade-certificate/person/upload-idcard",
            type: "post",
            data: data,
            contentType: false,
            //默认文件类型application/x-www-form-urlencoded  设置之后multipart/form-data
            processData: false,
            // 默认情况下会对发送的数据转化为对象 不需要转化的信息
            success: function (res) {
                alert(JSON.stringify(res));
            },
        });
    })
</script>
</body>
</html>
<script>
    $(function(){
        // 随机生成62位数字字符串
        function randomWord(flag,min,max) {
            // flag 是否任意长度  min 任意长度最小位   max 任意长度最大位
            let str = ''
            range = min 
            arr = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
            // 随机产生
            if (flag) {
                range = Manth.round(Math.random()*(max-min)) + min
            }
            for (let i = 0;i<range;i++) {
                j = Math.round(Math.random()*(arr.length-1))
                str += arr[j]
            }
            return str;
        }
        // 进入页面给私钥赋值
        function init() {
            let str = "0x"
            str += randomWord(false,62)
            $("#private").val(str)
            console.log(str,"这是啥")
        }
        init()
    })
</script>